angular.module('paynotifyModule', []).controller('paynotifyController', ['$scope', '$http', '$location', function ($scope , $http, $location) {

    $scope.trade = $location.search();
    //支付宝账户 最小单位为元
    if($scope.trade.seller_id){
        $scope.trade.total_fee = parseFloat($scope.trade.total_fee);
        $scope.trade.pay_type = '支付宝即时支付';
    }
    //微信账户 最小单位为分
    else{
        $scope.trade.total_fee = parseFloat($scope.trade.total_fee)/100;
        $scope.trade.pay_type = '微信扫码支付';
    }
    //支付宝通知:
    /*
     {
     "body": "name",
     "buyer_email": "wang520123fan@163.com",
     "buyer_id": "2088502996312740",
     "exterface": "create_donate_trade_p",
     "is_success": "T",
     "notify_id": "RqPnCoPT3K9%2Fvwbh3InZc2gRorTU5qlqhbynjVXEKgK0WHtKVhVvTho4HLpS%2BHRf3vI5",
     "notify_time": "2016-12-06 10:04:34",
     "notify_type": "trade_status_sync",
     "out_trade_no": "1480989849034",
     "payment_type": "1",
     "seller_email": "jyjjh@mail.ccnu.edu.cn",
     "seller_id": "2088911275465084",
     "subject": "name",
     "total_fee": "0.01",
     "trade_no": "2016120621001003740279673698",
     "trade_status": "TRADE_FINISHED",
     "sign": "3e903eef0324b33f1464075929e2b6b0",
     "sign_type": "MD5"
     }
    */

    //微信通知:
    /*
     wxParams = {
     out_trade_no: '订单号',
     prepay_id: 'abcdefg,
     code_url: 'weixin://safasfsafdasf',
     body: '共产党员献爱心',
     subject: '共产党员献爱心',
     total_fee: 1,
     status : 1
     }
     */

    console.log('paynotify :' + JSON.stringify($location.search()));

}]);